//
//  AppView.m
//  MusicAnalyzer
//
//  Created by jiro on 12/04/05.
//  Copyright 2012 jiro music. All rights reserved.
//

#import "AppView.h"
#import "../StateMachine/Event/AllEvents.h"

@implementation AppView

@synthesize active;

- (id)initWithFrame:(NSRect)frame
{
    self = [super initWithFrame:frame];
    if (self)
	{
		active = NO;
    }
    return self;
}

- (void) drawRect: (NSRect) dirtyRect
{
	//	draw background
	NSBezierPath* path = [ NSBezierPath bezierPath ];
	[ [ NSColor whiteColor ] set ];
	[ path appendBezierPathWithRect: [ self bounds ] ];
	[ path fill ];

	if ( active )
	{
		[ [ NSColor cyanColor ] set ];
		[ path stroke ];
	}
}

- (void) mouseDown:(NSEvent *)theEvent
{
	AppMouseEvent* e = [ [ AppMouseEvent alloc ] initWithInstance: self ];
	[ [ self window ] mouseDown: e ];
}

- (void) activate: (BOOL) yesOrNo
{
	active = yesOrNo;
	[ self setNeedsDisplay: YES ];

}

- (HitTestInfo*) appHitTest:(NSPoint)aPoint
{
	return nil;
}

@end
